package com.bw.mapper;

import com.bw.bean.Vo;
import com.bw.bean.Vo1;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @ClassName VoMapper
 * @description: TODO
 * @date 2025年05月13日
 * @version: 1.0
 */
@Mapper
public interface VoMapper {
    @Select("select bt.name,if(ui.gender='M','男','女') gender,sum(total_amount) `value` from order_info oi\n" +
            "left outer join user_info ui on ui.id = oi.user_id\n" +
            "left join base_trademark bt on oi.tm_id=bt.id\n" +
            "group by bt.name,ui.gender;")
    List<Vo1> getList1();

    @Select("select bt.name,sum(total_amount) `value` from order_info oi\n" +
            "left join base_trademark bt on bt.id=oi.tm_id\n" +
            "group by bt.name\n" +
            "order by value asc;")
    List<Vo> getList2();

    @Select("select concat(substr(ui.birthday,3,1),'0后') name,sum(total_amount) `value` from order_info oi\n" +
            "left outer join user_info ui on ui.id = oi.user_id\n" +
            "group by concat(substr(ui.birthday,3,1),'0后');")
    List<Vo> getList3();

    @Select("select bp.name,sum(total_amount) `value` from order_info oi\n" +
            "left join base_province bp on bp.id = oi.province_id\n" +
            "group by bp.name;")
    List<Vo> getList4();
}
